package cn.westv.scps.web.controller.appversion.vo;

import cn.westv.scps.domain.AppVersionEntity;
import cn.westv.scps.utils.DateUtil;
import org.apache.commons.beanutils.BeanUtils;
import org.codehaus.jackson.map.util.BeanUtil;

import java.lang.reflect.InvocationTargetException;

/**
 * Created by Administrator on 2017/10/21.
 */
public class AppVersionVO {
    private String id;
    private String publishTime;
    private String versionNo;
    private String content;
    private String subscribe;
    private String url;
    private String appType;
    private String isForce;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPublishTime() {
        return publishTime;
    }

    public void setPublishTime(String publishTime) {
        this.publishTime = publishTime;
    }

    public String getVersionNo() {
        return versionNo;
    }

    public void setVersionNo(String versionNo) {
        this.versionNo = versionNo;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getSubscribe() {
        return subscribe;
    }

    public void setSubscribe(String subscribe) {
        this.subscribe = subscribe;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getAppType() {
        return appType;
    }

    public void setAppType(String appType) {
        this.appType = appType;
    }

    public String getIsForce() {
        return isForce;
    }

    public void setIsForce(String isForce) {
        this.isForce = isForce;
    }


    public static AppVersionVO poToVo(AppVersionEntity entity){
        AppVersionVO vo = new AppVersionVO();
        try {
            BeanUtils.copyProperties(vo,entity);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
        if(entity.getPublishTime() != null){
            vo.setPublishTime(DateUtil.dateToString(entity.getPublishTime()));
        }
        return vo;
    }
}
